//
//  SADefine.h
//  SunOn
//
//  Created by mc on 2017/5/2.
//  Copyright © 2017年 NeoZhang. All rights reserved.
//

#ifndef SADefine_h
#define SADefine_h


#pragma mark - 通用宏

//判断是否为空
#define SAkStringIsEmpty(str) ([str isKindOfClass:[NSNull class]] || str == nil || [str length] < 1 ? YES : NO )

#define SAkArrayIsEmpty(array) (array == nil || [array isKindOfClass:[NSNull class]] || array.count == 0)

#define SAkDictIsEmpty(dic) (dic == nil || [dic isKindOfClass:[NSNull class]] || dic.allKeys == 0)
//** 沙盒路径 ***********************************************************************************
//获取temp
#define SAkPathTemp NSTemporaryDirectory()
//获取沙盒 Document
#define SAkPathDocument [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]
//获取沙盒 Cache
#define SAkPathCache [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) firstObject]
//** 屏幕宽高 && App Frame && App Frame Height&Width ***********************************************************************************
#define SASCREEN_WIDTH            [[UIScreen mainScreen] bounds].size.width
#define SASCREEN_HEIGHT           [[UIScreen mainScreen] bounds].size.height
//** 图片相关***********************************************************************************
//读取本地图片
#define SALOADIMAGE(file,ext) [UIImage imageWithContentsOfFile:［NSBundle mainBundle]pathForResource:file ofType:ext]
//定义UIImage对象
#define SAIMAGE(A) [UIImage imageWithContentsOfFile:［NSBundle mainBundle] pathForResource:A ofType:nil]
//定义UIImage对象
#define SAImageNamed(name) [UIImage imageNamed:name]
//** 通知中心***********************************************************************************
#define SANotificationCenter [NSNotificationCenter defaultCenter]
#define SAUserDefault [NSUserDefaults standardUserDefaults]
//适配屏幕DX为:750*1334 iphone6
//** 宽高比例***********************************************************************************
#define SAkWidth_scale (SASCREEN_WIDTH / 375)
#define SAkHeight_scale (SASCREEN_HEIGHT / 667)

//** 判断版本***********************************************************************************
#define IOS9 ([[[UIDevice currentDevice] systemVersion] floatValue] <= (9) ? YES : NO)
#define iOSVersion(version) ([[[UIDevice currentDevice] systemVersion] floatValue] >= (version) ? YES : NO)
//** 判断用户的手机型号***********************************************************************************
#define SAkiPhone5 (SCREEN_WIDTH == 320 ? YES : NO)
#define SAkiPhone6 (SCREEN_WIDTH == 375 ? YES : NO)
#define SAkiPhone6Plus (SCREEN_WIDTH == 414 ? YES : NO)
//** 输出宏***********************************************************************************
#ifdef DEBUG
#define DLog(...) NSLog(__VA_ARGS__)
#define debugMethod() NSLog(@"%s", __func__)
#else
#define DLog(...)
#define debugMethod()
#endif
//** 提示框***********************************************************************************
#define SAAlertShow(string) UIAlertController *alert1 = [UIAlertController alertControllerWithTitle:@"" message:string preferredStyle:(UIAlertControllerStyleAlert)]; \
UIAlertAction *action = [UIAlertAction actionWithTitle:@"确定" style:(UIAlertActionStyleDefault) handler:nil]; \
[alert1 addAction:action]; \
[self presentViewController:alert1 animated:YES completion:nil];
//** View 圆角和加边框 ***********************************************************************************
#define SAViewBorderRadius(View, Radius, Width, Color)\
\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES];\
[View.layer setBorderWidth:(Width)];\
[View.layer setBorderColor:[Color CGColor]]
//** View 圆角 ***********************************************************************************
#define SAViewRadius(View, Radius)\
\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES]
#pragma mark - 工程专用
//** 版本号***********************************************************************************
#define SAkVersion [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]
//** 工程名***********************************************************************************
#define SAkAPPName [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"]
//** APP登陆标识
#define SAkLogin @"SALogin"

#endif /* SADefine_h */
